<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="com.chanyachting.emall.serviceImpl.*" %>
<%@ page import="com.chanyachting.emall.service.*" %>
<%@ page import="com.chanyachting.emall.dao.ChannelDAO" %>
<%@ page import="com.chanyachting.emall.domain.Channel" %>
<%@ page import="com.chanyachting.emall.util.*" %>
<%@ page import="com.chanyachting.emall.domain.Member" %>
<%
	String rootPath = request.getContextPath();
%>
<script type="text/javascript">
<!--
function callLoginServer() {
	var userName = document.loginForm1.account.value;
	var userPass = document.loginForm1.password.value;
	if (userName == "") {
		alert("请输入用户名！");
		return false;
	} else if (userPass == "") {
		alert("请输入密码！");
		return false;
	}
	document.loginForm1.submit();
}

function gotoRegister() {
	document.location.href = "/chinayachting/frontend/member/reg_01.jsp";
}
//-->
</script>
<div id="header">
  <div class="line1">
    	<div class="date"><iframe src="http://m.weather.com.cn/n/pn14/weather.htm?id=101020100T " width="300" height="25" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"></iframe></div>
        <div class="weather"></div>
        <div class="guidebook"></div>
      <div class="login" id="login">
      <% 
          RequestUtil ru = new RequestUtil(request);
          Member m = (Member)ru.getSessionObject("MEMBER_IN_SESSION");
          if (m == null) {
      %>
       	<form id="form1" name="loginForm1" method="post" action="/chinayachting/member/login.do" onsubmit="return callLoginServer();">
        	<label>用户名：</label><input name="account" type="text" class="nameid" id="textfield" />
            <label>密码：</label><input name="password" type="password" class="pwd" id="textfield2" />
            <input type="button" name="login" id="button" value="登录" class="btn" onclick="callLoginServer();"/> 
            <input type="button" name="register" id="button" value="注册" class="btn"  onclick="gotoRegister();"/>
       	</form>
       <%
          } else {
        	  out.print(m.getMemberName());
        	  if ("01".equals(m.getSex())) {
        		  out.print("先生");
        	  } else if ("02".equals(m.getSex())) {
        		  out.print("女士");
        	  }
        	  out.print(",欢迎光临中华游艇网！");
          }
       %>
      </div>
        <div class="clear"></div>
  </div>
  	<div>
   	  	<div id="logo" title="中华游艇"><a href="/chinayachting/index.jsp"><img src="/chinayachting/images/logo.gif" alt="中华游艇" /></a></div>
  <div id="language">
        	<ul>
            	<li><a href="#" title="中文">中文</a></li>
                <li><a href="#" title="繁体">繁体</a></li>
                <li><a href="#" title="英语">英语</a></li>
            </ul>
      </div>
      <div id="nav">
    		<img src="/chinayachting/images/banner_03.jpg" alt="广告" />
    	</div>
        <div class="clear"></div>
  </div>
</div>
<div class="navbar">
     	<%
     		ChannelService service = new ChannelServiceImpl(new ChannelDAO());
     		List<Channel> list = service.getAllPrimaryChannel();
     	%>
     		<ul>
            	<li><a href="<%=rootPath %>/index.jsp" title="首 页">首 页</a></li>
     	<%
     		Channel c = null;
     		Channel aboutCh = null;
     		int channelCnt = 1;
     		if (list != null && list.size()>0) {
     			Iterator<Channel> it = list.iterator();
     				while(it.hasNext()) {
         				c = (Channel)it.next();
         				channelCnt ++;
						int pri = c.getPri() == null?0:c.getPri();
         				if (pri == 18) {
         					aboutCh = c;
         					continue;
         				}
         				String channelName = c.getName();
         				Integer id = c.getId();
         				String type = c.getType();		//是属于哪儿大的频道分类
         				if ("01".equals(type)) {		//新闻活动
         %>
               		<li><a href="<%=rootPath %>/frontend/activities/readActivityNews.do?channelId=<%=id%>" title="<%=channelName%>"><%=channelName%></a></li>
         <%			
         				} else if ("02".equals(type)) { //游艇销售
         %>
                    <li><a href="<%=rootPath %>/frontend/sale/Index.do?channelId=<%=id%>" title="<%=channelName%>"><%=channelName%></a></li>
         <%					
         				} else if ("03".equals(type)) { //游艇租赁
         %>
                    <li><a href="<%=rootPath %>/frontend/lease/readAllRentInf.do?channelId=<%=id%>" title="<%=channelName%>"><%=channelName%></a></li>
         <%						
         				} else if ("04".equals(type)) { //码头俱乐部
         %>
                    <li><a href="<%=rootPath %>/frontend/club/readDockyacht.do?channelId=<%=id%>" title="<%=channelName%>"><%=channelName%></a></li>
         <%					
         				} else if ("05".equals(type)) { //招聘求职
         %>
                    <li><a href="<%=rootPath %>/frontend/hr/offerJob.do" title="<%=channelName%>"><%=channelName%></a></li>
         <%				
         				} else if ("06".equals(type)) { //展览赛事
         %>
                    <li><a href="<%=rootPath %>/frontend/exhibition/Index.do?channelId=<%=id%>" title="<%=channelName%>"><%=channelName%></a></li>
         <%				
         				} else if ("07".equals(type)) { //游艇黄页
         %>
                    <li><a href="<%=rootPath %>/frontend/yellow/yellowPages.do?channelId=<%=id%>" title="<%=channelName%>"><%=channelName%></a></li>
         <%				
         				} else {
         %>
         					<li><a href="#" title="<%=c.getName()%>"><%=c.getName() %></a></li>
         <%
         				}			
     				}
     			}
     	%>
            </ul>
</div>
